#include <bits/stdc++.h>
using namespace std;
using uint=unsigned int;
using ll=long long;
using ull=unsigned long long;
using i128=__int128;
const int N=1e6+5;

void tree(string s1,string s2){
    int l1=s1.length();
    int l2=s2.length();
    if(l1>0){
        char ch=s2[l2-1];
        cout<<ch;
        int pos=s1.find(ch);
        tree(s1.substr(0,pos),s2.substr(0,pos));
        tree(s1.substr(pos+1),s2.substr(pos,l1-pos-1));
    }
    return;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    string s1,s2;
    cin>>s1>>s2;
    tree(s1,s2);
    cout<<endl;

    return 0;
}